package com.bolins.tag;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

@SuppressWarnings("serial")
public class IndexJspTag extends TagSupport {

	@Override
	public int doEndTag() throws JspException {
		return EVAL_PAGE;
	}

	@Override
	public int doStartTag() throws JspException {
		String context = ((HttpServletRequest) pageContext.getRequest())
				.getContextPath();
		String html = new StringBuffer().append("<a href=\"").append(context)
				.append("/index.jsp\">").append("返回首页").append("</a>")
				.toString();
		try {
			pageContext.getOut().write(html);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return SKIP_BODY;
	}

}
